 /*
 * motor.c
 *
 *  Created on: 2023/12/22
 *      Author: run
 */
#include "zf_common_headfile.h"

#ifndef MOTOR_H_
#define MOTOR_H_

#define Suspemotor_l                   (TIM3_PWM_MAP3_CH1_C6)
#define Suspemotor_r                   (TIM3_PWM_MAP3_CH2_C7)

#define MAX_DUTY             (50 )                                               //最大输出占空比

#define DIR_RL               (D12 )
#define PWM_RL               (TIM4_PWM_MAP1_CH2_D13)
#define DIR_SL               (D15 )
#define PWM_SL               (TIM4_PWM_MAP1_CH3_D14)

#define DIR_RR               (A1 )
#define PWM_RR               (TIM5_PWM_MAP0_CH1_A0)
#define DIR_SR               (A2 )
#define PWM_SR               (TIM5_PWM_MAP0_CH4_A3)

#define MAX_DUTY_POWERMOTOR  75
#define MIN_DUTY_POWERMOTOR  -75


void Suspension_motor_init(void);
void Suspension_motor_set(uint32 duty1, uint32 duty2);
void Suspension_motor_pid(uint32 duty);

void Left_motor_init(void);
void Right_motor_init(void);

void Left_motor_set(void);
void Right_motor_set(void);

void Motor_duty_clear(void);
void Motor_duty_game_um();
void Motor_duty_debug_lm(void);
void Motor_duty_debug_rm(void);
void Motor_duty_debug_um(void);


extern int8 duty_rl;
extern int8 duty_sl;

extern int8 duty_rr;
extern int8 duty_sr;

extern uint16 duty_susl;
extern uint16 duty_susr;

extern uint8 motor_stop;

#endif /* MOTOR_H_ */
